package dyyx.demo;

import java.util.HashMap;
import java.util.Map;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import reactor.core.publisher.Flux;

@RestController
public class HelloController {

	@RequestMapping("hello")
	public Flux<String> hello() {
		return Flux.just("Hello World");
	}

	@GetMapping(value = "hello2", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
	public Flux<String> hello2() {
		return Flux.just("Hello World");
	}

	@RequestMapping("hello3")
	public Object hello3() {
		Map map = new HashMap();
		map.put("id", 1);
		map.put("name", "dyyx");

		return Flux.just(map);
	}

	@RequestMapping("hello4")
	public Object hello4() {
		Map map = new HashMap();
		map.put("id", 1);
		map.put("name", "dyyx");

		return map;
	}
}